int searchInsert(int *nums, int numsSize, int target)
{
    int left, right, mid;
    left = 0;
    right = numsSize - 1;
    while (left <= right)//二分法
    {
        mid = (left + right) / 2;
        if (nums[mid] == target)
        {
            return mid;
        }
        else if (nums[mid] < target)
        {
            left = mid + 1;
        }
        else if (nums[mid] > target)
        {
            right = mid - 1;
        }
    }
    return left;
}